package cn.fzkj.exception;

public class BaseException extends RuntimeException {
    /**
     * 错误码
     */
    private int errorCode;

    /**
     * 错误信息
     */
    private String errorMessage;

    /**
     * 传参
     */
    private Object errorResult;

    public BaseException(IResponseEnum resp, Object os) {
        super(resp.getMessage());
        this.errorCode = resp.getCode();
        this.errorMessage = resp.getMessage();
        this.errorResult = os;
    }

    public BaseException(IResponseEnum resp, Object[] args, String message) {
        super(resp.getMessage());
        this.errorCode = resp.getCode();
        this.errorMessage = resp.getMessage();
        this.errorResult = args;
    }

    public BaseException(IResponseEnum resp, Object[] args, String message, Throwable cause) {
        super(resp.getMessage(), cause);
        this.errorCode = resp.getCode();
        this.errorMessage = resp.getMessage();
        this.errorResult = args;
    }

    public int getErrorCode() {
        return errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public Object getErrorResult() {
        return errorResult;
    }
}
